#include<stdio.h>
#include<string.h>
char a[300];
int main(){
    int n;
    scanf("%d",&n);
    int valid=0;
    int invalid=0;
     int j=0;
     int bj=0;
     getchar();
   for(int i=1;i<=n;i++){
    fgets(a,sizeof(a),stdin);
     a[strcspn(a, "\n")] = '\0';//
    j=0;
    bj=0;
    if(a[j]=='_'||((a[j]>='A'&&a[j]<='Z')||(a[j]>='a'&&a[j]<='z'))){
    j++;
    while(a[j]!='\n'){
        if(a[j]>='A'&&a[j]<='Z'){j++;continue;}
        if(a[j]>='a'&&a[j]<='z'){j++;continue;}
        if(a[j]>='0'&&a[j]<='9'){j++;continue;}
        if(a[j]=='_'){j++;continue;}
        bj=1;
        break;
    }
    if(bj)invalid++;
    else valid++;
    }
    else invalid++;
   }
   printf("Valid:%d\nInvalid:%d",valid,invalid);
}